<template>
  <div>
    <el-dialog
      title="保费确认"
      :visible.sync="dialogVisibles"
      width="30%"
      :before-close="handleClose"
    >
      <div class="main">
        <el-form>
          <el-form-item
            label="收款金额"
            label-width="120px"
            class="el-form-item"
          >
            <!-- <el-input v-model="form.pipeiAmount"></el-input> -->
            <span>{{ amount }}</span>
          </el-form-item>
          <el-form-item
            label="保费月份"
            label-width="120px"
            class="el-form-item"
          >
            <el-date-picker type="month" v-model="form.baofeiYuefen" placeholder="选择日期" value-format=" yyyy-MM">
            </el-date-picker>
          </el-form-item>
             <el-form-item label="保费金额" label-width="120px" class="el-form-item">
                  <el-input v-model="form.pipeiAmount" onkeyup="value=value.replace(/[^\d]/g,'')"></el-input>
              </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="confirm">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { dataPipei } from "@/api/antborrow/expenditure";
export default {
  props: ["dialogVisibles", "row"],
  data() {
    return {
      amount:"",
      form: {
        type: "1",
        pipeiAmount: "",
        baofeiYuefen:"",
        id: "",
      },
    };
  },
  watch: {
    row(val) {
      this.amount = val.amount;
      this.form.id = val.id;
    },
  },
  methods: {
    confirm() {
      dataPipei(this.form).then((res) => {
        if (res.data.code == 0) {
          if (res.data.data == true) {
            this.$message({
              type: "success",
              message: "操作成功",
            });
            this.form.baofeiYuefen = ""
            this.form.pipeiAmount = ""
          this.$emit("handleCurrentChange", 1);
          } else {
            this.$message({
              type: "error",
              message: "操作失败",
            });
            this.form.baofeiYuefen = ""
            this.form.pipeiAmount = ""
          }

         
        }
      });
      this.$emit("closeWindow");
    },
    handleClose() {
                this.form.pipeiAmount = ""
            this.form.baofeiYuefen = ""
      this.$emit("closeWindow");
    },
  },
};
</script>

<style scoped>
</style>
